 #!/usr/local/bin/perl
use strict;

print "<xml>\n\n";
my %special_character = (">"=>"&gt;", "<"=>"&lt;", "\""=>"&quot;", "\'"=>"&apos;");
while (@ARGV)
{
  my $arg=shift(@ARGV);
  my @topnode = split(/\./, $arg);

  open my $input, "<", $arg;

  my $line = <$input>;
  chomp($line);
  my @header = split(/;/, $line);

  while($line = <$input>)
  {
        chomp($line);
        print "<$topnode[0]>\n";
        my @data = split(/;/, $line);
        for ( my $i = 0; $i < scalar(@data); $i++ )
        {
                  my @data2 =split(/:/, @data[$i]);
                  for my $element (@data2)
                  {
					$element =~ s/&/(&apos)/g;
					foreach (keys %special_character)
					{
						$element =~ s/($_)/$special_character{$_}/g;
					}
                    print "<".@header[$i].">".$element."</".@header[$i].">\n";
                  }
        }
        print "</$topnode[0]>\n\n";
  }
}
print "</xml>";